<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#mycanvas{
				border: aqua solid 3px;
			}
		</style>
	</head>
	<body>
		<canvas id="mycanvas" width="400" height="300"></canvas>
	</body>
	<script type="text/javascript">
		var canvas = document.getElementById('mycanvas');
		var context = canvas.getContext('2d');
		context.beginPath();
		
		context.moveTo(0,0);
		context.lineTo(400,300);
		context.lineTo(100,200);
		context.lineTo(200,50);
		context.lineTo(400,200);
	    context.fillStyle = 'black';
		context.fill();
		context.lineWidth = 4;//没有px单位
		context.strokeStyle = 'brown';
		context.stroke();
		context.closePath();
	</script>
</html>
